//
//  UITextField+JwCate.m
//  JwPack
//
//  Created by 陈警卫 on 2022/8/24.
//

#import "UITextField+JwCate.h"

@implementation UITextField (JwCate)

/// 设置placeholder
- (void)jw_setupPlaceholderText:(NSString *)text color:(UIColor *)color {
    [self jw_setupPlaceholderText:text color:color font:self.font];
}

/// 设置placeholder
- (void)jw_setupPlaceholderText:(NSString *)text color:(UIColor *)color font:(UIFont *)font {
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    if (color) {
        dict[NSForegroundColorAttributeName] = color;
    }
    if (font) {
        dict[NSFontAttributeName] = font;
    }
    NSAttributedString *attr = [[NSAttributedString alloc] initWithString:text
                                                               attributes:dict];
    self.attributedPlaceholder = attr;
}

@end
